public class ThreadDemo6 {
    public static void main(String[] args) throws InterruptedException {
        Object locker = new Object();
        Thread t1 = new Thread(() -> {
            synchronized(locker) {
                try {
                    System.out.println("wait()之前");
                    locker.wait();
                    System.out.println("wait()之后");
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        Thread t2 = new Thread(() -> {
            synchronized(locker) {
                System.out.println("notify()之前");
                locker.notify();
                System.out.println("notify()之后");
            }
        });

        t1.start();
        Thread.sleep(100);
        t2.start();
    }
}
